<cfsetting requesttimeout="600">

<cfabort>

<cfquery name="GetPBQ2" datasource="calgrants_workshops">
	select Student_ID, Q2
	from PB_Exit_Surveys_2012
</cfquery>

<cfloop query="GetPBQ2">

	<cfquery name="UpdateEval" datasource="calgrants_workshops">
		update Evaluation
		set Q2 = '#Q2#'
		where Student_ID = #Student_ID#
	</cfquery>

</cfloop>

Done.

<cfabort>

<!--- Randomly rank LA_Passports_2012 --->

<!--- <cfquery name="GetPassports" datasource="calgrants_workshops">
	select Passport_ID
	from LA_Passport_2012
</cfquery>

<cfhttp method="get" url="http://www.random.org/sequences/" result="result">
	<cfhttpparam type="url" name="min" value="1">
	<cfhttpparam type="url" name="max" value="#GetPassports.RecordCount#">
	<cfhttpparam type="url" name="rnd" value="new">
	<cfhttpparam type="url" name="col" value="#GetPassports.RecordCount#">
	<cfhttpparam type="url" name="format" value="plain">
</cfhttp>

<cfset picks = ListChangeDelims(result.filecontent, ",", chr(9))>

<cfset loopCount = 1>

<cfoutput>
	<cfloop index="rank" list="#picks#">
		#rank#<br />
		<cfquery name="SetRank" datasource="calgrants_workshops">
			update LA_Passport_2012
			set Rank = #rank#
			where Passport_ID = #loopCount#
		</cfquery>
		<cfset loopCount = loopCount + 1>
	</cfloop>
</cfoutput> --->

<!--- <cfdump var="#result#"> --->

<!--- Randomly rank LA_Passports_2012 --->

<!--- End: Randomly rank LA_Passports_2012 --->

<!--- <cfquery name="GetRecipients" datasource="calgrants_workshops">
	select Student_ID
	from Draw_Group_Pool_2012
	where Recipient = 1
</cfquery>

<cfloop query="GetRecipients">
	<cfquery name="UpdateStudent" datasource="calgrants_workshops">
		update Student
		set Recipient = 1
		where Student_ID = #Student_ID#
	</cfquery>
</cfloop> --->

<!--- Migrate workshop combinations from Workshop_Combination_2012 to Draw_Group_2012 and Draw_Group_Workshop_2012

NOTE.  The schema of Draw_Group_2012 was changed after this script was run and should be altered for future runs.  Added a field Workshop_IDs to Draw_Group_2012 which holds a list of Workshop_ID's that make up the draw group.  A value is present for non-combined draw groups as well as combined. --->

	<!--- <cfquery name="GetWorkshopCombinations" datasource="calgrants_workshops">
		select *
		from Workshop_Combination_2012
		where Migrated = 0
	</cfquery>
	
	<cfquery name="GetCombinations" dbtype="query">
		select Combine
		from GetWorkshopCombinations
		where Combine is not null and Combine <> ''
	</cfquery>
	
	<cfset combinedWorkshopIDs = "">
	<cfloop query="GetCombinations">
		<cfloop index="i" list="#Combine#" delimiters="_">
			<cfif ListFind(combinedWorkshopIDs, i) eq 0>
				<cfset combinedWorkshopIDs = ListAppend(combinedWorkshopIDs, i)>
			</cfif>
		</cfloop>
	</cfloop>
	
	<cfoutput>
	
	<p>combinedWorkshopIDs: #combinedWorkshopIDs#</p>
	
	<!--- get bad combinations where Combine value does not contain the Workshop_ID for the current records, when combined --->
	<cfloop query="GetWorkshopCombinations">
		<cfif Len(Trim(Combine)) gt 0>
			<cfif ListFind(Trim(Combine), Workshop_ID, "_") eq 0>
				Error in Workshop_ID #Workshop_ID# (Region #Region_ID#) has value "#Combine#" in Combine.<br />
			</cfif>
		<cfelse>
			<!--- get cases where a Workshop_ID has been combined, but it isn't noted in the Combine field --->
			<cfif ListFind(combinedWorkshopIDs, Workshop_ID) gt 0>
				Error in Workshop_ID #Workshop_ID# (Region #Region_ID#) has no value in Combine.<br />
			</cfif>
		</cfif>
	</cfloop>
	
	</cfoutput>
	
	<cfoutput>
	
	<cfloop query="GetWorkshopCombinations">
		<!--- if workshop is not combined --->
		<cfif Len(Trim(Combine)) eq 0>
			<cfquery name="DupeCheck" datasource="calgrants_workshops">
				select count(*) as recs
				from Draw_Group_Workshop_2012
				where Workshop_ID = #Workshop_ID#
			</cfquery>
			<cfif DupeCheck.recs eq 0>
				<cfquery name="MigrateToDrawGroup" datasource="calgrants_workshops">
					insert into Draw_Group_2012
					(Drawn, Combo, Survey_Count, Award_Count, Workshop_Count, Workshop_IDs)
					values
					(0, 0, #Survey_Count#, 1, 1, #Workshop_ID#)
					
					select @@identity as id
				</cfquery>
				<cfquery name="MigrateToDrawGroupWorkshop" datasource="calgrants_workshops">
					insert into Draw_Group_Workshop_2012
					(Draw_Group_ID, Workshop_ID)
					values
					(#MigrateToDrawGroup.id#, #Workshop_ID#)
					
					select @@identity as id
				</cfquery>
				<cfquery name="UpdateWorkshopCombination" datasource="calgrants_workshops">
					update Workshop_Combination_2012
					set Migrated = 1,
					Draw_Group_ID = #MigrateToDrawGroup.id#,
					Draw_Group_Workshop_ID = #MigrateToDrawGroupWorkshop.id#
					where Workshop_Combination_ID = #Workshop_Combination_ID#
				</cfquery>
			<cfelse>
				Workshop_ID #Workshop_ID# failed DupeCheck for non-combined workshop.<br />
			</cfif>
		<!--- if workshop is combined --->
		<cfelse>
			<cfquery name="DupeCheckDG" datasource="calgrants_workshops">
				select count(*) as recs
				from Draw_Group_Workshop_2012
				where Workshop_ID = #Workshop_ID#
			</cfquery>
			<cfif DupeCheckDG.recs eq 0>
				<cfset surveyCount = 0>
				<cfloop index="w" list="#Combine#" delimiters="_">
					<cfquery name="GetSurveyCount" datasource="calgrants_workshops">
						select survey_count
						from Workshop_Combination_2012
						where Workshop_ID = #w#
					</cfquery>
					<cfset surveyCount = surveyCount + GetSurveyCount.survey_count>				
				</cfloop>
				<cfquery name="InsertDrawGroup" datasource="calgrants_workshops">
					insert into Draw_Group_2012
					(Drawn, Combo, Survey_Count, Award_Count, Workshop_Count, Workshop_IDs)
					values
					(0, 1, #surveyCount#, 1, #ListLen(Combine, "_")#, '#ListChangeDelims(Combine, ",", "_")#')
					
					select @@identity as id
				</cfquery>
				<cfloop index="wid" list="#Combine#" delimiters="_">
					<cfquery name="DupeCheckDGW" datasource="calgrants_workshops">
						select count(*) as recs
						from Draw_Group_Workshop_2012
						where Workshop_ID = #wid#
					</cfquery>
					<cfif DupeCheckDGW.recs eq 0>
						<cfquery name="InsertDGW" datasource="calgrants_workshops">
							insert into Draw_Group_Workshop_2012
							(Draw_Group_ID, Workshop_ID)
							values
							(#InsertDrawGroup.id#, #wid#)
							
							select @@identity as id
						</cfquery>
						<cfquery name="UpdateWorkshopCombination2012" datasource="calgrants_workshops">
							update Workshop_Combination_2012
							set Migrated = 1,
							Draw_Group_ID = #InsertDrawGroup.id#,
							Draw_Group_Workshop_ID = #InsertDGW.id#
							where Workshop_ID = #wid#
						</cfquery>
					<cfelse>
					
					</cfif>
				</cfloop>
			</cfif>
		</cfif>
	</cfloop>
	</cfoutput>
	
	<cfabort> --->

<!--- End: Migrate workshop combinations from Workshop_Combination_2012 to Draw_Group_2012 and Draw_Group_Workshop_2012 --->


<!--- Populate Draw_Group_2012.Qualified_Count with the number of students who passed the qualifcation criteria. --->

	<!--- <cfquery name="GetDrawGroups" datasource="calgrants_workshops">
		select Draw_Group_ID, Workshop_IDs
		from Draw_Group_2012
	</cfquery>
	<cfquery name="QualifiedScholarshipRecipients" datasource="calgrants_workshops">
		select Workshop_ID
		from [Qualified Scholarship Recipients 2012]
	</cfquery>
	<cfloop query="GetDrawGroups">
		<cfset qualifiedCount = 0>
		<cfloop index="wsid" list="#Workshop_IDs#">
			<cfquery name="GetQualifiedScholarshipRecipients" dbtype="query">
				select count(Workshop_ID) as recs
				from QualifiedScholarshipRecipients
				where Workshop_ID = #wsid#
			</cfquery>
			<cfif IsNumeric(GetQualifiedScholarshipRecipients.recs)>
				<cfset qualifiedCount = qualifiedCount + GetQualifiedScholarshipRecipients.recs>
			<cfelse>
				<cfoutput>
					Value for Workshop_ID: #wsid# of get qualified scholarship recipients is: "#GetQualifiedScholarshipRecipients.recs#".<br />
				</cfoutput>
			</cfif>
		</cfloop>
		<cfquery name="UpdateDrawGroup" datasource="calgrants_workshops">
			update Draw_Group_2012
			set Qualified_Count = #qualifiedCount#
			where Draw_Group_ID = #Draw_Group_ID#
		</cfquery>
	</cfloop>
	
	Done with update draw group qualified_count.
	
<cfabort> --->

<!--- END: Populate Draw_Group_2012.Qualified_Count with the number of students who passed the qualifcation criteria. --->


<!--- Populate Draw_Group_2012.Dedupe_Count with the number of students in a workshop after deduping. --->

	<!--- <cfquery name="GetDrawGroups" datasource="calgrants_workshops">
		select Draw_Group_ID, Workshop_IDs
		from Draw_Group_2012
	</cfquery>
	<cfquery name="UnqualifiedScholarshipRecipients" datasource="calgrants_workshops">
		select Workshop_ID
		from [Unqualified Scholarship Recipients 2012]
	</cfquery>
	<cfloop query="GetDrawGroups">
		<cfset unqualifiedCount = 0>
		<cfloop index="wsid" list="#Workshop_IDs#">
			<cfquery name="GetUnqualifiedScholarshipRecipients" dbtype="query">
				select count(Workshop_ID) as recs
				from UnqualifiedScholarshipRecipients
				where Workshop_ID = #wsid#
			</cfquery>
			<cfif IsNumeric(GetUnqualifiedScholarshipRecipients.recs)>
				<cfset unqualifiedCount = unqualifiedCount + GetUnqualifiedScholarshipRecipients.recs>
			<cfelse>
				<cfoutput>
					Value for Workshop_ID: #wsid# of get unqualified scholarship recipients is: "#GetUnqualifiedScholarshipRecipients.recs#".<br />
				</cfoutput>
			</cfif>
		</cfloop>
		<cfquery name="UpdateDrawGroup" datasource="calgrants_workshops">
			update Draw_Group_2012
			set Dedupe_Count = #unqualifiedCount#
			where Draw_Group_ID = #Draw_Group_ID#
		</cfquery>
	</cfloop>
	
	Done with update draw group dedupe_count.
	
	<cfabort> --->
	
<!--- END: Populate Draw_Group_2012.Dedupe_Count with the number of students in a workshop after deduping. --->


<!--- In Draw_Group_2012, pick 15 random numbers between 1 and the number of qualified scholarship recipients (Qualified_Count) and insert them into the Picks field.  These numbers will be used to select the scholarship winner and determine the order of the alternates --->

	<!---<cfquery name="GetDrawGroups" datasource="calgrants_workshops">
		select Draw_Group_ID, Qualified_Count, Survey_Count
		from Draw_Group_2012
		where Picks is Null
		and Qualified_Count > 0
	</cfquery>
	
	<cfoutput>
	<table border="1" cellpadding="6" cellspacing="0">
		<tr>
			<td>Draw_Group_ID</td>
			<td>Survey_Count</td>
			<td>Qualified_Count</td>
			<td>Picks</td>
		</tr>
		
		<cfloop query="GetDrawGroups">
			<cfset picks = "">
			<cfif Qualified_Count gt 1>
				<cfhttp method="get" url="http://www.random.org/sequences/" result="result">
					<cfhttpparam type="url" name="min" value="1">
					<cfhttpparam type="url" name="max" value="#Qualified_Count#">
					<cfhttpparam type="url" name="rnd" value="new">
					<cfhttpparam type="url" name="col" value="#Qualified_Count#">
					<cfhttpparam type="url" name="format" value="plain">
				</cfhttp>
				<cfset picks = ListChangeDelims(result.filecontent, ",", chr(9))>
			<cfelseif Qualified_Count eq 1>
				<cfset picks = 1>
			</cfif>
			
			<tr>
				<td>#Draw_Group_ID#</td>
				<td>#Survey_Count#</td>
				<td>#Qualified_Count#</td>
				<td>#picks#</td>
			</tr>

			<cfquery name="InsertPicks" datasource="calgrants_workshops">
				update Draw_Group_2012
				set Picks = <cfqueryparam cfsqltype="cf_sql_varchar" value="#picks#" null="#IIf(Len(Trim(picks)) eq 0, true, false)#">
				where Draw_Group_ID = #Draw_Group_ID#
			</cfquery>

		</cfloop>
		</table>
	</cfoutput>
	
	<cfabort>--->

<!--- END:  In Draw_Group_2012, pick 15 random numbers between 1 and the number of qualified scholarship recipients (Qualified_Count) and insert them into the Picks field.  These numbers will be used to select the scholarship winner and determine the order of the alternates --->

<!--- Select records into Draw_Group_Pool_2012 using Draw_Group_2012.Picks to randomize the records. --->

	<!---<cfquery name="GetDrawGroups" datasource="calgrants_workshops">
		select Draw_Group_ID, Workshop_IDs, Picks, Qualified_Count
		from Draw_Group_2012
		where Drawn = 0
	</cfquery>
	
	<cfquery name="GetQualifiedScholarshipRecipients" datasource="calgrants_workshops">
		select Student_ID, Workshop_ID
		from [Qualified Scholarship Recipients 2012]
	</cfquery>
	<cfoutput>
		<cfloop query="GetDrawGroups">
			<cfquery name="GetDrawGroupQualifiedRecipients" dbtype="query">
				select Student_ID, Workshop_ID
				from GetQualifiedScholarshipRecipients
				where Workshop_ID IN (#Workshop_IDs#)
				order by Student_ID
			</cfquery>
			<p>Student_IDs: #ValueList(GetDrawGroupQualifiedRecipients.Student_ID)#<br />
			Picks: #Picks#</p>
			<cfset pickNo = 1>
			<cfloop index="r" list="#Picks#">
				Student_ID: #GetDrawGroupQualifiedRecipients["Student_ID"][r]# Workshop_ID: #GetDrawGroupQualifiedRecipients["Workshop_ID"][r]#<br />
				<cfquery name="InsertDrawGroupPool" datasource="calgrants_workshops">
					insert into Draw_Group_Pool_2012
					(Draw_Group_ID, Workshop_ID, Student_ID, Rank, Disqualified, Awarded)
					values
					(#Draw_Group_ID#, #GetDrawGroupQualifiedRecipients["Workshop_ID"][r]#, #GetDrawGroupQualifiedRecipients["Student_ID"][r]#, #pickNo#, 0, 0)
				</cfquery>
				<cfif pickNo eq 15>
					<cfbreak>
				</cfif>
				<cfset pickNo = pickNo + 1>
			</cfloop>
			<hr />
			<cfquery name="UpdateDrawGroup" datasource="calgrants_workshops">
				update Draw_Group_2012
				set Drawn = 1
				where Draw_Group_ID = #Draw_Group_ID#
			</cfquery>
		</cfloop>
	</cfoutput>
	
	<cfabort>--->

<!--- END:  Select records into Draw_Group_Pool_2012 using Draw_Group_2012.Picks to randomize the records. --->

<!--- Update values in Draw_Group_Pool_2012 after records have been established with Draw_Group_ID, Workshop_ID, Student_ID and Rank. Disqualified and Awarded have been set to 0.  All other fields are Null before running this script. --->

	<!---<cfquery name="GetDrawGroupPool" datasource="calgrants_workshops" maxrows="1000">
		select Draw_Group_Pool_ID, Student_ID
		from Draw_Group_Pool_2012
		where Workshop_Site is Null
	</cfquery>
	
	<cfloop query="GetDrawGroupPool">
		<cfquery name="GetStudent" datasource="calgrants_workshops">
			select *
			from Student
			where Student_ID = #Student_ID#
		</cfquery>
		<cfquery name="GetWorkshop" datasource="calgrants_workshops">
			select *
			from Workshop left outer join Site
			on Workshop.Site_ID = Site.Site_ID
			where Workshop_ID = #GetStudent.Workshop_ID#
		</cfquery>
		<cfquery name="GetEvaluation" datasource="calgrants_workshops">
			select *
			from Evaluation
			where Student_ID = #Student_ID#
		</cfquery>
		<cfquery name="GetGDS" datasource="calgrants_workshops">
			select *, [SSN NBR] as ssnGDS, [GDS DOB] as dobGDS, [On Time ISIR] as onTimeISIR, [MATCH CRITERIA NBR] as gdsMatchRound,
			[On Time GPA] as onTimeGPA, [GDS FIRST NAME] as gdsFirstName, [GDS LAST NAME] as gdsLastName, [GDS STR ADDR] as gdsAddress, [GDS CITY] as gdsCity, [GDS ZIP] as gdsZipCode, [GDS PHONE] as gdsPhone
			from GDS_2012
			where Student_ID = #Student_ID#
		</cfquery>
		<cfquery name="UpdateDrawGroupPool" datasource="calgrants_workshops">
			UPDATE [calgrants_workshops].[dbo].[Draw_Group_Pool_2012]
			SET [Workshop_Site] = '#GetWorkshop.Site#'
				,[Workshop_Address] = '#GetWorkshop.Address#'
				,[Workshop_City] = '#GetWorkshop.City#'
				,[Origin] = '#GetStudent.Origin#'
				,[First_Name] = '#GetStudent.First_Name#'
				,[First_Name_GDS] = '#GetGDS.gdsFirstName#'
				,[Last_Name] = '#GetStudent.Last_Name#'
				,[Last_Name_GDS] = '#GetGDS.gdsLastName#'
				,[Address] = '#GetStudent.Address#'
				,[Address_GDS] = '#GetGDS.gdsAddress#'
				,[City] = '#GetStudent.City#'
				,[City_GDS] = '#GetGDS.gdsCity#'
				,[Zip_Code] = '#GetStudent.Zip_Code#'
				,[Zip_Code_GDS] = '#GetGDS.gdsZipCode#'
				,[Phone1] = '#GetStudent.Phone1#'
				,[Phone2] = '#GetStudent.Phone2#'
				,[Phone_GDS] = '#GetGDS.gdsPhone#'
				,[High_School] = '#GetEvaluation.Q8#'
				,SSN_Code = '#GetStudent.SSN_Code#'
				,[SSN4] = '#GetStudent.SSN#'
				,[SSN_GDS] = '#GetGDS.ssnGDS#'
				,[DOB_GDS] = '#GetGDS.dobGDS#'
				,[DOB_CFC] = '#GetStudent.DOB#'
				,[Q7] = '#GetEvaluation.Q7#'
				,[On_Time_ISIR] = '#GetGDS.onTimeISIR#'
				,[GPA] = '#GetGDS.GPA#'
				,[GDS_Match_Round] = '#GetGDS.gdsMatchRound#'
				,[Q16] = '#GetEvaluation.Q16#'
				,[On_Time_GPA] = '#GetGDS.onTimeGPA#'
			WHERE Draw_Group_Pool_ID = #Draw_Group_Pool_ID#
		</cfquery>
	</cfloop>
	
	<cfabort> --->

<!--- END:  Update values in Draw_Group_Pool_2012 after records have been established with Draw_Group_ID, Workshop_ID, Student_ID and Rank. Disqualified and Awarded have been set to 0.  All other fields are Null before running this script. --->

<!--- Update values in Draw_Group_Pool_2012.SSN_Code as follow up to GDS, Student and Evaluation data. --->

	<!--- <cfquery name="GetDrawGroupPool" datasource="calgrants_workshops">
		select Draw_Group_Pool_ID, Student_ID
		from Draw_Group_Pool_2012
		where SSN_Code is Null
	</cfquery>
	
	<cfloop query="GetDrawGroupPool">
		<cfquery name="GetStudent" datasource="calgrants_workshops">
			select SSN_Code
			from Student
			where Student_ID = #Student_ID#
		</cfquery>
		<cfquery name="UpdateDrawGroupPool" datasource="calgrants_workshops">
			UPDATE [calgrants_workshops].[dbo].[Draw_Group_Pool_2012]
			SET [SSN_Code] = '#GetStudent.SSN_Code#'
			WHERE Draw_Group_Pool_ID = #Draw_Group_Pool_ID#
		</cfquery>
	</cfloop>
	
	<cfabort> --->

<!--- END:  Update values in Draw_Group_Pool_2012.SSN_Code as follow up to GDS, Student and Evaluation data. --->

<!--- At this point in the process we manually verify the winners for each Draw_Group_2012 record.  This is done by finding the first match (according to Draw_Group_Pool_2012.Rank) and set the Awarded field to true.  Also, where there is no GDS match, verify unmatched candidates for AB540 status.  Despina called each AB540 candidate and verified their status.  If a candidate was found to not be AB540 and didn't submit their GPA and FAFSA on time, the next ranked candidate is selected for verification.  ---->

<!--- Migrate Draw_Group_Pool_2012 winners to Scholarships.  This will cause the Recipients and Scholarships pages in the WMS to show the new recipients for the year. --->

<!--- <cfquery name="GetAwardees" datasource="calgrants_workshops" maxrows="100">
	SELECT [Draw_Group_Pool_ID]
		,[Draw_Group_ID]
		,[Workshop_ID]
		,[Student_ID]
		,[Rank]
		,[Recipient]
		,[AB540]
		,[GDS_Match]
		,[Scholarship_ID]
		,[Workshop_Site]
		,[Workshop_Address]
		,[Workshop_City]
		,[Origin]
		,[First_Name]
		,[First_Name_GDS]
		,[Last_Name]
		,[Last_Name_GDS]
		,[Address]
		,[Address_GDS]
		,[City]
		,[City_GDS]
		,[Zip_Code]
		,[Zip_Code_GDS]
		,[Phone1]
		,[Phone2]
		,[Phone_GDS]
		,[High_School]
		,[SSN_Code]
		,[SSN4]
		,[SSN_GDS]
		,[DOB_GDS]
		,[DOB_CFC]
		,[Q7]
		,[On_Time_ISIR]
		,[GPA]
		,[GDS_Match_Round]
		,[Q16]
		,[On_Time_GPA]
	FROM [calgrants_workshops].[dbo].[Draw_Group_Pool_2012]
	where Recipient = 1 and Scholarship_ID is Null
</cfquery>

<cfoutput>
<cfloop query="GetAwardees">
	<cfif Len(Trim(SSN_GDS)) gt 0>
		<cfset ssnFormatted = Left(SSN_GDS, 3) & "-" & Mid(SSN_GDS, 4, 2) & "-" & Right(SSN_GDS, 4)>
	</cfif>
	<cfset claimID = IIf(Origin eq "Web", DE("W"), DE("P")) & Workshop_ID & Student_ID>
	#claimID# #ssnFormatted#<br />
	<cfquery name="InsertScholarship" datasource="calgrants_workshops">
		INSERT INTO [calgrants_workshops].[dbo].[Scholarship]
           ([Deleted]
           ,[Student_ID]
           ,[Claim_ID]
           ,[Claim_Date]
           ,[Cohort]
           ,[Scholarship_Type]
           ,[PBS]
           ,[Research_ID]
           ,[First_Name]
           ,[Last_Name]
           ,[SSN]
           ,[DOB]
           ,[Gender]
           ,[Race_Ethnicity]
           ,[Address]
           ,[City]
           ,[Zip_Code]
           ,[Email]
           ,[Home_Phone]
           ,[Cell_Phone]
           ,[Password]
           ,[High_School]
           ,[Graduation_Month]
           ,[Graduation_Year]
           ,[Volunteer]
           ,[Authorized]
           ,[Login_Token]
           ,[Login_Date_Time]
           ,[Institution1_ID]
           ,[Institution2_ID]
           ,[Institution3_ID]
           ,[Enrollment_Date]
           ,[Attendance_Level]
           ,[Degree_Level]
           ,[Notes]
           ,[Account_Type]
           ,[Routing_Number]
           ,[Account_Number]
           ,[GDS_Match]
           ,[AB540]
           ,[Date_Created])
     VALUES
           (0
           ,#Student_ID#
           ,'#claimID#'
           ,Null
           ,4
           ,'CCFC'
           ,0
           ,Null
           ,Null
           ,Null
		   <cfif Len(Trim(SSN_GDS)) gt 0>
         	  ,'#ssnFormatted#'
		   <cfelse>
			   ,Null
		   </cfif>
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,0
           ,0
           ,0
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,Null
           ,#IIf(GDS_Match eq 1, DE(1), DE(0))#
           ,#IIf(AB540 eq 1, DE(1), DE(0))#
           ,#now()#)
		   
		   select @@identity as id
	</cfquery>
	
	<cfquery name="UpdateDrawGroupPool" datasource="calgrants_workshops">
		update Draw_Group_Pool_2012
		set Scholarship_ID = #InsertScholarship.id#
		where Draw_Group_Pool_ID = #Draw_Group_Pool_ID#
	</cfquery>

</cfloop>
</cfoutput> --->

<!--- ************************************************************************* --->

<cfabort>


<cfsetting showdebugoutput="no">